package com.wgchao.identityrightsmanagement.infrastructure.convert;

import com.wgchao.identityrightsmanagement.domain.organization.model.Office;
import com.wgchao.identityrightsmanagement.infrastructure.jpa.entity.SysBaseOffice;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

/**
 * @ClassName: OfficeConvert
 * @author: wgchao
 * @createTime: 2020/6/16 4:57 PM
 * @Description: TODO
 */
@Component
public class OfficeConvert {

    public Office convert(SysBaseOffice sysBaseOffice){
        Office office = new Office(sysBaseOffice.getId(), sysBaseOffice.getCode(), sysBaseOffice.getName(), sysBaseOffice.getAgencyCode(),
                sysBaseOffice.getDescription(), sysBaseOffice.isDisabled(), sysBaseOffice.getVersion());
        return office;
    }

    public SysBaseOffice convert(Office office){
        SysBaseOffice sysBaseOffice = new SysBaseOffice();
        BeanUtils.copyProperties(office, sysBaseOffice);
        return sysBaseOffice;
    }
}
